package com.zhonghui.modlules.user.eshopMapper;


import com.zhonghui.common.eshopDomain.ShopUser;
import com.zhonghui.common.eshopMapper.CoreMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

@Repository
public interface UserMapper extends CoreMapper<ShopUser> {

    @Update({"update eshop_user set brokerage_price = brokerage_price+ ${price} where uid = #{id}"})
    void incBrokeragePrice(@Param("price") BigDecimal price, @Param("id") Long id);


    @Update({"update eshop_user set now_money=now_money-#{payPrice} where uid=#{uid}"})
    int decPrice(@Param("payPrice") BigDecimal payPrice, @Param("uid") Long uid);



    @Update({"update eshop_user set pay_count=pay_count+1 where uid=#{uid}"})
    int incPayCount(@Param("uid") Long uid);
}
